package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
@JsonIgnoreProperties("handler")
public class NewsCatalog extends BaseDomain {

    public static final Integer STATE_START = 1;        //启动
    public static final Integer STATE_BAN = 0;          //禁止

    private String name;           //日报目录名

    private Integer state;         //日报目录状态

    private Long sequence;          //日报目录序号

    //返回的状态
    public String getStateString(){
        String temp = "启动";
        if (state == 0){
            temp = "禁止";
        }
        return temp;
    }

    //封装成json数据
    public Object getJson(){
        Map map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("sequence",sequence);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }
}